﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Doo.Controls
{
/*
 * 客户端的XML数据源
 * 简单。
 * 提供的方法：isdatauseable,get_xml(process_handler,fail_handler)
 */

    [DefaultProperty("XMLUrl")]
    [ToolboxData("<{0}:ClientXMLDataSource runat=server></{0}:ClientXMLDataSource>")]
    [ParseChildren(ChildrenAsProperties=true)]
    public class XMLDataSource : DataSource.DataSourceBase
    {
        const string _ScriptName = "Doo.WebUI.DataSource.XMLDataSource.script.js";

        
        #region 基本属性

        public override string ClientControlType
        {
            get
            {
                return "Doo.DataSource.XMLDataSource";
            }
        }

        public override string ScriptResourceName
        {
            get
            {
                return _ScriptName;
            }
        }

        #endregion

        public string XMLUrl { get; set; }

        protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors()
        {
            ScriptControlDescriptor descriptor = new ScriptControlDescriptor(this.ClientControlType, this.ClientID);
            descriptor.AddProperty("xmlurl", this.XMLUrl);
            yield return descriptor;
        }
    }
}
